#!/usr/bin/perl

# $Id: 10_hostchecker_utils.t 209 2010-07-12 18:54:35Z dolbanavt $
# $Date: 2010-07-12 21:54:46 +0300 (Пнд, 12 Июл 2010) $
# $HeadURL: https://robosearch.googlecode.com/svn/branches/reborn/t/10_hostchecker_utils.t $
# $LastChangedRevision$

use FindBin qw( $RealBin );
use File::Spec::Functions qw( catfile );

BEGIN {
    push @INC, catfile( $RealBin, '..', 'base_lib' );
    push @INC, catfile( $RealBin, '..', 'lib' );
}

use JIP::ToolSet;
use English qw( -no_match_vars );
use Test::More tests => 10;
use Test::Exception;

use_ok 'HostChecker::Utils';
require_ok 'HostChecker::Utils';

can_ok 'HostChecker::Utils', qw(
    find_active_hosts_in
    resolve_nbn_for
    find_active_ftp_servers
);

throws_ok { find_active_hosts_in(); }
    qr{^Undefined\ssubroutine\s&main::find_active_hosts_in}xms,
    'find_active_hosts_in() is not exported';

throws_ok { resolve_nbn_for(); }
    qr{^Undefined\ssubroutine\s&main::resolve_nbn_for}xms,
    'resolve_nbn_for() is not exported';

throws_ok { find_active_ftp_servers(); }
    qr{^Undefined\ssubroutine\s&main::find_active_ftp_servers}xms,
    'find_active_ftp_servers() is not exported';

throws_ok { HostChecker::Utils::find_active_hosts_in(); }
    qr{^subnet_mask\srequired}xms,
    'find_active_hosts_in(subnet_mask)';

throws_ok { HostChecker::Utils::resolve_nbn_for(); }
    qr{^ip_address\srequired}xms,
    'resolve_nbn_for(ip_address)';

throws_ok { HostChecker::Utils::find_active_ftp_servers(); }
    qr{^Required\soption\s'max_threads'\sis\snot\sprovided}xms,
    'find_active_ftp_servers(max_threads)';

throws_ok { HostChecker::Utils::find_active_ftp_servers( max_threads => q{} ); }
    qr{^Required\soption\s'hosts_ref'\sis\snot\sprovided}xms,
    'find_active_ftp_servers(max_threads,hosts_ref)';
